using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class PractitionerIDNumberTypeAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public PractitionerIDNumberTypeAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.User;
						tableVersionTypes[HL7Version.v231] = HL7TableType.User;
						tableVersionTypes[HL7Version.v24] = HL7TableType.User;
						tableVersionTypes[HL7Version.v25] = HL7TableType.User;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{""};
						validVersionCodes[HL7Version.v231] = new string[]{"UPIN","SL","MCD","GL","CY","TAX","DEA","MCR","L&I","QA","TRL"};
						validVersionCodes[HL7Version.v24] = new string[]{"CY","DEA","GL","L&I","MCD","MCR","QA","SL","TAX","TRL","UPIN"};
						validVersionCodes[HL7Version.v25] = new string[]{"CY","DEA","GL","LI","L&I","MCD","MCR","QA","SL","TAX","TRL","UPIN"};
						validVersionCodes[HL7Version.v251] = new string[]{"CY","DEA","GL","LI","L&I","MCD","MCR","QA","SL","TAX","TRL","UPIN"};
						validVersionCodes[HL7Version.v26] = new string[]{"CY","DEA","GL","LI","L&I","MCD","MCR","QA","SL","TAX","TRL","UPIN"};
						validVersionCodes[HL7Version.v27] = new string[]{"CY","DEA","GL","LI","L&I","MCD","MCR","QA","SL","TAX","TRL","UPIN"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{""};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Unique physician ID no.","State license number","Medicaid number","General ledger number","County number","Tax ID number","Drug Enforcement Agency no.","Medicare number","Labor and industries number","QA number","Training license number"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"County number","Drug Enforcement Agency no.","General ledger number","Labor and industries number","Medicaid number","Medicare number","QA number","State license number","Tax ID number","Training license number","Unique physician ID no."};
						validVersionDescriptions[HL7Version.v25] = new string[]{"County number","Drug Enforcement Agency no.","General ledger number","Labor and industries number","Labor and industries number","Medicaid number","Medicare number","QA number","State license number","Tax ID number","Training license number","Unique physician ID no."};
						validVersionDescriptions[HL7Version.v251] = new string[]{"County number","Drug Enforcement Agency no.","General ledger number","Labor and industries number","Labor and industries number","Medicaid number","Medicare number","QA number","State license number","Tax ID number","Training license number","Unique physician ID no."};
						validVersionDescriptions[HL7Version.v26] = new string[]{"County number","Drug Enforcement Agency no.","General ledger number","Labor and industries number","Labor and industries number","Medicaid number","Medicare number","QA number","State license number","Tax ID number","Training license number","Unique physician ID no."};
						validVersionDescriptions[HL7Version.v27] = new string[]{"County number","Drug Enforcement Agency no.","General ledger number","Labor and industries number","Labor and industries number","Medicaid number","Medicare number","QA number","State license number","Tax ID number","Training license number","Unique physician ID no."};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
